﻿@using Smartstore.Core.Checkout.Orders
 
@model OrderSettingsModel

@{
    ViewBag.Title = T("Admin.Configuration.Settings.Order").Value;
    Layout = "_SettingLayout";
}

<form asp-action="Order">
    <div class="section-header">
        <div class="title">
            <i class="far fa-chart-bar"></i>
            @T("Admin.Configuration.Settings.Order")
        </div>
        <div class="options">
            <button type="submit" name="save" value="save" class="btn btn-warning">
                <i class="fa fa-check"></i>
                <span>@T("Admin.Common.Save")</span>
            </button>
        </div>
    </div>

    @await Component.InvokeAsync("StoreScope")

    <div asp-validation-summary="All"></div>

    <tabstrip id="generalsettings-edit" sm-nav-style="Material">
        <tab sm-title="@T("Admin.Configuration.Settings.Order.OrderSettings")" sm-selected="true">
            <div class="adminContent">
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="IsReOrderAllowed" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="IsReOrderAllowed"></setting-editor>
                        <span asp-validation-for="IsReOrderAllowed"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="OrderTotalMinimum" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="OrderTotalMinimum" sm-postfix="@Model.PrimaryStoreCurrencyCode"></setting-editor>
                        <span asp-validation-for="OrderTotalMinimum"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="OrderTotalMaximum" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="OrderTotalMaximum" sm-postfix="@Model.PrimaryStoreCurrencyCode"></setting-editor>
                        <span asp-validation-for="OrderTotalMaximum"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="MultipleOrderTotalRestrictionsExpandRange" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="MultipleOrderTotalRestrictionsExpandRange"></setting-editor>
                        <span asp-validation-for="MultipleOrderTotalRestrictionsExpandRange"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="AnonymousCheckoutAllowed" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="AnonymousCheckoutAllowed"></setting-editor>
                        <span asp-validation-for="AnonymousCheckoutAllowed"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="DisableOrderCompletedPage" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="DisableOrderCompletedPage"></setting-editor>
                        <span asp-validation-for="DisableOrderCompletedPage"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="GiftCardsActivatedOrderStatusId" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="GiftCardsActivatedOrderStatusId">
                            <select asp-for="GiftCardsActivatedOrderStatusId" asp-items="Html.GetLocalizedEnumSelectList(typeof(OrderStatus))" asp-placeholder="@T("Common.PleaseSelect")"></select>
                        </setting-editor>
                        <span asp-validation-for="GiftCardsActivatedOrderStatusId"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="GiftCardsDeactivatedOrderStatusId" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="GiftCardsDeactivatedOrderStatusId">
                            <select asp-for="GiftCardsDeactivatedOrderStatusId" asp-items="Html.GetLocalizedEnumSelectList(typeof(OrderStatus))" asp-placeholder="@T("Common.PleaseSelect")"></select>
                        </setting-editor>
                        <span asp-validation-for="GiftCardsDeactivatedOrderStatusId"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="MaxMessageOrderAgeInDays" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="MaxMessageOrderAgeInDays" sm-postfix="@T("Time.Days")"></setting-editor>
                        <span asp-validation-for="MaxMessageOrderAgeInDays"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="OrderListPageSize" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="OrderListPageSize"></setting-editor>
                        <span asp-validation-for="OrderListPageSize"></span>
                    </div>
                </div>
                <div sm-if="Model.OrderIdent.HasValue" class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="OrderIdent" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="OrderIdent"></setting-editor>
                    </div>
                </div>
                <div sm-if="Model.StoreCount > 1" class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="DisplayOrdersOfAllStores" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="DisplayOrdersOfAllStores"></setting-editor>
                        <span asp-validation-for="DisplayOrdersOfAllStores"></span>
                    </div>
                </div>
            </div>
        </tab>
        <tab sm-title="@T("Admin.Configuration.Settings.Order.ReturnRequestSettings")">
            <div class="alert alert-info alert-dismissible">
                @Html.Raw(T("Admin.Configuration.Settings.Order.ReturnRequestsDescription1"))
                <br />
                @Html.Raw(T("Admin.Configuration.Settings.Order.ReturnRequestsDescription2"))
                <button type="button" class="btn-close" data-dismiss="alert"></button>
            </div>

            <div class="adminContent mb-3">
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="ReturnRequestsEnabled" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="ReturnRequestsEnabled"></setting-editor>
                        <span asp-validation-for="ReturnRequestsEnabled"></span>
                    </div>
                </div>
                <div class="adminRow">
                    <div class="adminTitle">
                        <smart-label asp-for="NumberOfDaysReturnRequestAvailable" />
                    </div>
                    <div class="adminData">
                        <setting-editor asp-for="NumberOfDaysReturnRequestAvailable" sm-postfix="@T("Time.Days")"></setting-editor>
                        <span asp-validation-for="NumberOfDaysReturnRequestAvailable"></span>
                    </div>
                </div>
            </div>

            @(Html.LocalizedEditor<OrderSettingsModel, OrderSettingsLocalizedModel>("setting-order-localized",
		    @<div class="adminContent">
			    <div class="adminRow">
				    <div class="adminTitle">
					    <smart-label asp-for="Locales[item].ReturnRequestReasons" />
				    </div>
                    <div class="adminData">
                        @*IMPORTANT: Do not delete, this hidden element contains the id to assign localized values to the corresponding language *@
                        <input type="hidden" asp-for="Locales[item].LanguageId" />

                        <setting-editor asp-for="Locales[item].ReturnRequestReasons"></setting-editor>
                        <span asp-validation-for="Locales[item].ReturnRequestReasons"></span>
                    </div>
			    </div>
			    <div class="adminRow">
				    <div class="adminTitle">
                        <smart-label asp-for="Locales[item].ReturnRequestActions" />
				    </div>
				    <div class="adminData">
                        <setting-editor asp-for="Locales[item].ReturnRequestActions"></setting-editor>
                        <span asp-validation-for="Locales[item].ReturnRequestActions"></span>
				    </div>
			    </div>
		    </div>
		    ,
		    @<div class="adminContent">
			    <div class="adminRow">
				    <div class="adminTitle">
					    <smart-label asp-for="ReturnRequestReasons" />
				    </div>
                    <div class="adminData">
                        <setting-editor asp-for="ReturnRequestReasons"></setting-editor>
                        <span asp-validation-for="ReturnRequestReasons"></span>
                    </div>
			    </div>
			    <div class="adminRow">
				    <div class="adminTitle">
                        <smart-label asp-for="ReturnRequestActions" />
				    </div>
				    <div class="adminData">
                        <setting-editor asp-for="ReturnRequestActions"></setting-editor>
                        <span asp-validation-for="ReturnRequestActions"></span>
				    </div>
			    </div>
		    </div>
	    ))
        </tab>
    </tabstrip>
</form>